return FALSE;
g_autofree char *kernel_cmdline = read_proc_cmdline ();
- g_autoptr (RootConfig) composefs_config
+ g_autoptr (RootConfig) rootfs_config
= otcore_load_rootfs_config (kernel_cmdline, config, TRUE, error);
- if (!composefs_config)
+ if (!rootfs_config)
return FALSE;
- if (composefs_config->enabled != OT_TRISTATE_YES)
+ if (rootfs_config->enabled != OT_TRISTATE_YES)
return glnx_throw (error, "soft reboot not supported without composefs");
GVariantBuilder metadata_builder;
// Tracks if we did successfully enable it at runtime
bool using_composefs = false;
- if (!otcore_mount_rootfs (composefs_config, &metadata_builder, root_transient, sysroot_path,
+ if (!otcore_mount_rootfs (rootfs_config, &metadata_builder, root_transient, sysroot_path,
target_deployment, OTCORE_RUN_NEXTROOT, &using_composefs, error))
return glnx_prefix_error (error, "failed to mount composefs");
// out if it's enabled, but not supported at compile time.
// However, we don't load the keys here, because they may not exist, such
// as in the initial deploy
- g_autoptr (RootConfig) composefs_config
+ g_autoptr (RootConfig) rootfs_config
= otcore_load_rootfs_config ("", prepare_root_config, FALSE, error);
- if (!composefs_config)
- return glnx_prefix_error (error, "Reading composefs config");
+ if (!rootfs_config)
+ return glnx_prefix_error (error, "Reading rootfs config");
- OtTristate composefs_enabled = composefs_config->enabled;
+ OtTristate composefs_enabled = rootfs_config->enabled;
g_debug ("composefs enabled by config: %d repo: %d", composefs_enabled, repo->composefs_wanted);
if (repo->composefs_wanted == OT_TRISTATE_YES)
composefs_enabled = repo->composefs_wanted;
g_auto (GVariantBuilder) cfs_checkout_opts_builder
= G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_VARDICT);
guint32 composefs_requested = 1;
- if (composefs_config->require_verity)
+ if (rootfs_config->require_verity)
composefs_requested = 2;
g_variant_builder_add (&cfs_checkout_opts_builder, "{sv}", "verity",
g_variant_new_uint32 (composefs_requested));
}
gboolean
-otcore_mount_rootfs (RootConfig *composefs_config, GVariantBuilder *metadata_builder,
+otcore_mount_rootfs (RootConfig *rootfs_config, GVariantBuilder *metadata_builder,
gboolean root_transient, const char *root_mountpoint, const char *deploy_path,
const char *mount_target, bool *out_using_composefs, GError **error)
{
#ifdef HAVE_COMPOSEFS
/* We construct the new sysroot in /sysroot.tmp, which is either the composefs
mount or a bind mount of the deploy-dir */
- if (composefs_config->enabled == OT_TRISTATE_NO)
+ if (rootfs_config->enabled == OT_TRISTATE_NO)
return TRUE;
g_autofree char *sysroot_objects = g_strdup_printf ("%s/ostree/repo/objects", root_mountpoint);
cfs_options.flags = LCFS_MOUNT_FLAGS_READONLY;
}
- if (composefs_config->is_signed)
+ if (rootfs_config->is_signed)
{
- const char *composefs_pubkey = composefs_config->signature_pubkey;
+ const char *composefs_pubkey = rootfs_config->signature_pubkey;
g_autoptr (GVariant) commit = NULL;
g_autoptr (GVariant) commitmeta = NULL;
return glnx_throw (error, "Signature validation requested, but no signatures in commit");
g_autoptr (GBytes) commit_data = g_variant_get_data_as_bytes (commit);
- if (!validate_signature (commit_data, signatures, composefs_config->pubkeys, error))
+ if (!validate_signature (commit_data, signatures, rootfs_config->pubkeys, error))
return glnx_prefix_error (error, "No valid signatures found for public key");
g_print ("composefs+ostree: Validated commit signature using '%s'\n", composefs_pubkey);
expected_digest = g_malloc (OSTREE_SHA256_STRING_LEN + 1);
ot_bin2hex (expected_digest, cfs_digest_buf, g_variant_get_size (cfs_digest_v));
- g_assert (composefs_config->require_verity);
+ g_assert (rootfs_config->require_verity);
cfs_options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_VERITY;
g_print ("composefs: Verifying digest: %s\n", expected_digest);
cfs_options.expected_fsverity_digest = expected_digest;
}
- else if (composefs_config->require_verity)
+ else if (rootfs_config->require_verity)
{
cfs_options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_VERITY;
}
else
{
int errsv = errno;
- g_assert (composefs_config->enabled != OT_TRISTATE_NO);
- if (composefs_config->enabled == OT_TRISTATE_MAYBE && errsv == ENOENT)
+ g_assert (rootfs_config->enabled != OT_TRISTATE_NO);
+ if (rootfs_config->enabled == OT_TRISTATE_MAYBE && errsv == ENOENT)
{
g_print ("composefs: No image present\n");
}
}
#else
/* if composefs is configured as "maybe", we should continue */
- if (composefs_config->enabled == OT_TRISTATE_YES)
+ if (rootfs_config->enabled == OT_TRISTATE_YES)
return glnx_throw (error, "composefs: enabled at runtime, but support is not compiled in");
#endif
*out_using_composefs = using_composefs;
/**
* otcore_mount_rootfs:
- * @composefs_config: Configuration for composefs.
+ * @rootfs_config: Configuration for root
* @metadata_builder: (transfer none): GVariantBuilder to add metadata to.
* @root_transient: Whether the root filesystem is transient.
* @root_mountpoint: The mount point of the physical root filesystem.
*
* Returns: %TRUE on success, %FALSE on error.
*/
-gboolean otcore_mount_rootfs (RootConfig *composefs_config, GVariantBuilder *metadata_builder,
+gboolean otcore_mount_rootfs (RootConfig *rootfs_config, GVariantBuilder *metadata_builder,
gboolean root_transient, const char *root_mountpoint,
const char *deploy_path, const char *mount_target,
bool *out_using_composefs, GError **error);
// We always parse the composefs config, because we want to detect and error
// out if it's enabled, but not supported at compile time.
- g_autoptr (RootConfig) composefs_config
+ g_autoptr (RootConfig) rootfs_config
= otcore_load_rootfs_config (kernel_cmdline, config, TRUE, &error);
- if (!composefs_config)
+ if (!rootfs_config)
errx (EXIT_FAILURE, "%s", error->message);
// If composefs is enabled, that also implies sysroot.readonly=true because it's
// the new default we want to use (not because it's actually required)
- const bool sysroot_readonly_default = composefs_config->enabled == OT_TRISTATE_YES;
+ const bool sysroot_readonly_default = rootfs_config->enabled == OT_TRISTATE_YES;
if (!ot_keyfile_get_boolean_with_default (config, SYSROOT_KEY, READONLY_KEY,
sysroot_readonly_default, &sysroot_readonly, &error))
errx (EXIT_FAILURE, "Failed to parse sysroot.readonly value: %s", error->message);
* However, we only do this if composefs is not enabled, because we don't
* want to parse the target root filesystem before verifying its integrity.
*/
- if (!sysroot_readonly && composefs_config->enabled != OT_TRISTATE_YES)
+ if (!sysroot_readonly && rootfs_config->enabled != OT_TRISTATE_YES)
{
sysroot_readonly = sysroot_is_configured_ro (root_arg);
// Encourage porting to the new config file
// Tracks if we did successfully enable it at runtime
bool using_composefs = false;
- if (!otcore_mount_rootfs (composefs_config, &metadata_builder, root_transient, root_mountpoint,
+ if (!otcore_mount_rootfs (rootfs_config, &metadata_builder, root_transient, root_mountpoint,
deploy_path, TMP_SYSROOT, &using_composefs, &error))
errx (EXIT_FAILURE, "Failed to mount composefs: %s", error->message);
* Also, hotfixes are incompatible with signed composefs use for security reasons.
*/
if (lstat (OTCORE_HOTFIX_USR_OVL_WORK, &stbuf) == 0
- && !(using_composefs && composefs_config->is_signed))
+ && !(using_composefs && rootfs_config->is_signed))
{
/* Do we have a persistent overlayfs for /usr? If so, mount it now. */
const char usr_ovl_options[]